package com.bingbaihanji.config;

import com.bingbaihanji.mapper.AreaMapper;
import io.quarkus.runtime.Startup;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;

/**
 * @author 冰白寒祭
 * @date 2024-04-06 18:44:34
 * @description //TODO
 */

//用 @Startup 在程序启动时初始化一个 CDI bean
@ApplicationScoped
public class InitDataBase {

    @Inject
    AreaMapper areaMapper;

    @Startup
    void init() {
        initAreaH2Database();
    }

    public void initAreaH2Database() {
        // 建表
        areaMapper.createAreaTable();
        // 初始化
        areaMapper.insertAreaSql();
    }


}
